package com.springboot.cloud.demos.producer.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.springboot.cloud.demos.entity.po.Message;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.Map;

@Repository
@Mapper
public interface MessageMapper extends BaseMapper<Message> {
    @Select("SELECT a.id, a.title,a.content,a.created_time as createdTime,a.type,a.value_type as valueType,is_read as isRead,value_id as valueId,"+
            "c.id as userId, c.nickname,c.avatar  from t_message a " +
            "left join t_user c on c.id=a.from_user_id ${ew.customSqlSegment}")
    @Override
    IPage<Map<String, Object>> selectMapsPage(IPage page, @Param("ew") Wrapper queryWrapper);

}
